#include <stdint.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include "module.h"
#include <stdint.h>
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
#include <sys/select.h>
#include "sys/err.h"


extern sys_api_t * sysapi;

void sha1_starts(void)
{
        sysapi->sha1_starts();
}
void sha1_update(uint8_t *input, int ilen)
{
        sysapi->sha1_update(input, ilen);
}

void sha1_finish(uint8_t output[20])
{
        sysapi->sha1_finish(output);
}

/* Single-key DES key schedule */
int deskey(uint8_t key[8], int decrypt)
{
        return sysapi->deskey(key, decrypt);
}
int des(uint8_t block[8], uint8_t output[8])
{
        return sysapi->des(block, output);
}

/* Triple-DES key schedule */
int des3key2(uint8_t key[16], int decrypt)
{
        return sysapi->des3key2(key, decrypt);
}
int des3key3(uint8_t key[24], int decrypt)
{
        return sysapi->des3key3(key, decrypt);
}
int des3(uint8_t block[8], uint8_t output[8])
{
        return sysapi->des3(block, output);
}

uint8_t rng_get_byte()
{
        return sysapi->rng_get_byte();
}
int rng_get_string(uint8_t * buf, uint32_t len)
{
        return sysapi->rng_get_string(buf, len);
}

uint16_t crc16(uint16_t crc, uint8_t *buffer, uint32_t len)
{
        return sysapi->crc16(crc, buffer, len);
}

uint16_t crc16_itu_t(uint16_t crc, uint8_t *buffer, uint32_t len)
{
        return sysapi->crc16_itu_t(crc, buffer, len);
}

uint32_t crc32(uint32_t crc, uint8_t *buffer, uint32_t len)
{
        return sysapi->crc32(crc, buffer, len);
}


int sha2_starts(int is224)
{
        return sysapi->sha2_starts(is224);
}
void sha2_update(uint8_t * input, uint32_t length)
{
        sysapi->sha2_update(input, length);
}


void sha2_finish(uint8_t digest[32])
{
        sysapi->sha2_finish(digest);
}

